<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="width=device-width,initial-scale=1" />
		<meta http-equiv="X-UA-Compatible" content="IE=Edge">
		<title>财富共赢</title>
		<!--bootstrap-css-->
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Ak/lib/bootstrap/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Ak/css/base.css" />
		<link rel="stylesheet" type="text/css" href="__PUBLIC__/Ak/css/style.css" />
		<!--[if lte IE 9]>
    <script type="text/javascript" src="__PUBLIC__/Ak/lib/html5shiv/html5shiv.min.js" ></script>
    <script type="text/javascript" src="__PUBLIC__/Ak/Dt/lib/html5shiv/html5shiv-printshiv.min.js" ></script>
    <![endif]-->
		<script type="text/javascript" src="__PUBLIC__/Ak/lib/bootstrap/js/jquery.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/Ak/lib/bootstrap/js/bootstrap.min.js"></script>
		<script type="text/javascript" src="__PUBLIC__/Ak/js/yxk.js"></script>
	</head>
	<style type="text/css">
		.input-group {
			margin-bottom: 10px;
		}
		
		.input-group,
		.input-group input,
		.input-group span {
			border-top: none;
		}
		
		.input-group input {
			border-right: none;
		}
		
		.input-group span {
			border-left: none;
			background: #fff;
		}
		
		body {
			background-image: url('__PUBLIC__/Dt/image/mode-bg.jpg');
			background-repeat: no-repeat;
			background-size: cover;
		}
	</style>

	<body>
		<div id="main">
			<div class="header_bg">
				<div class="logo_box">
					<img src="__PUBLIC__/Ak/images/logo1.png" />
				</div>
			</div>
			<div class="container-fluid ">
				<div class="form_box">
					<form>
						<div class="input-group">
							<span class="input-group-addon"><i class="glyphicon glyphicon-list-alt"></i></span>
							<input type="text" class="form-control" placeholder="请输入账号" aria-describedby="basic-addon1" name="username" id="username" value="{$username}">
						</div>
						<!--<div class="form-group">
						  <span class="input-group-addon"><i class="glyphicon glyphicon-list-alt"></i></span>
							<input type="text" class="form-control" placeholder="请输入账号" name="username" id="username" value="{$username}">
						</div>-->
						<div class="input-group">
							<span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
							<input type="password" class="form-control" placeholder="请输入密码" name="password" id="password">
						</div>
						<div class="input-group" id="captcha-container">
							<span class="input-group-addon"><i class="glyphicon glyphicon-sort-by-alphabet-alt"></i></span>
							<input type="text" class="form-control" placeholder="输入验证码" name="verify" id="verify" value="{$code}" style="float:left;width:180px">
							<p style="position: absolute;right: 0;top: 0;z-index: 999;"><img width="100" style="cursor:pointer;" height="35" alt="验证码" src="{:U('home/index/verify',array())}" title="点击刷新"></p>
						</div>
						<div style="clear:both;padding-top:10px;"></div>
						<div class="form-group text-right">
							<label><a href="#">忘记密码?</a></label>
						</div>
						<button type="submit" class="btn btn-block text_fff bg_blue" onclick="return checkuser();" style="background: #FA460B;">登录</button>

					</form>
				</div>
			</div>
		</div>
	</body>

</html>
<script>
	var loginuser; //是否已经登录，1是 0否
	loginuser = 0;

	function checkuser() {

		if($.trim($("#username").val()) == "") {
			alert("请输入会员帐号！");
			$("#username").focus();
			return false;
		}

		var reg = /^[0-9a-zA-Z\u4e00-\u9fa5_]{1,16}$/;
		if(!reg.test($.trim($('#username').val()))) {
			alert('会员帐户由1-16位汉字、字母、数字、下划线组成！');
			$('#username').focus();
			return false;
		}
		if($.trim($("#password").val()) == "") {
			alert("请输入会员密码！");
			$("#password").focus();
			return false;
		}

		// if($.trim($("#mobile_code_login").val())=="")
		// {
		//     alert("请输入手机登录验证码！");
		//     $("#mobile_code_login").focus();
		//     return false;
		// }

		if($.trim($("#verify").val()) == "") {
			alert("请输入验证码！");
			$("#verify").focus();
			return false;
		}

		var username, password, verify;
		username = $.trim($('#username').val());
		password = $.trim($('#password').val());
		verify = $.trim($('#verify').val());

		$.ajax({
			type: "POST",
			url: "/home/index/dologinajax",
			//data: {'username':username,'password':password,'verify':verify,'login':loginuser,'mobile_code_login':$("#mobile_code_login").val()},
			data: {
				'username': username,
				'password': password,
				'verify': verify,
				'login': loginuser
			},
			async: false,
			//dataType: "json",
			success: function(data) {

				if(data == 1) {
					location.href = '/user/';
				}
				if(data == 2) {
					alert('会员帐户或者密码不对，请重新输入！');
					$('#username').focus();
					return false;
				}

				if(data == 3) {
					alert('帐户已经被冻结，如有疑问请联系客服，谢谢！');
					$('#verify').focus();
					return false;
				}

				if(data == 4) {
					alert('帐户还没有开通，请联系推荐人开通后再登录，谢谢！');
					$('#verify').focus();
					return false;
				}

				if(data == 5) {
					alert('验证码不正确，请重新输入！');
					$('#verify').focus();
					var captcha_img = $('#captcha-container').find('img');
					captcha_img.prop("src", '/home/index/verify.html?' + Math.random());

					return false;
				}
				if(data == 6) {
					if(confirm('用户已经在其它设备登录，是否重新登录？')) {
						loginuser = 1;
						checkuser();
					}
				}

				// if(data==7)
				// {
				//     alert('手机验证码不正确，请重新输入！');
				//     $('#mobile_code_login').focus();

				//     return false;
				// }
				if(data == 8) {
					alert('操作非法！');
					return false;
				}

			}
		})

		return false;
		//Save();//记住密码
		// $("#form").submit();
	}

	var captcha_img = $('#captcha-container').find('img')
	var verifyimg = captcha_img.attr("src");
	captcha_img.attr('title', '点击刷新');
	captcha_img.click(function() {
		if(verifyimg.indexOf('?') > 0) {
			$(this).attr("src", verifyimg + '&random=' + Math.random());
		} else {
			$(this).attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random());
		}
	});
</script>